import Vue from "vue"
import VueRouter from "vue-router"
import Login from '@/components/Login'
import Register from '@/components/Register'

import Index from '@/components/Index'
import Home from '@/components/Home'
import Users from '@/components/Users'
import Shops from '@/components/Shops'
import ShopDetails from '@/components/ShopDetails'
import Notice from '@/components/Notice'
import NoticeForm from '@/components/NoticeForm'
import Users2 from '@/components/Users2'
import Type from '@/components/Type'


Vue.use(VueRouter)

const router = new VueRouter({
    routes: [
        { path: '/', component: Login, name: 'Login' },
        { path: '/register', component: Register, name: 'Register' },
        {
            path: '/index', component: Index, children: [
                { path: "", component: Home },
                { path: "users", component: Users },
                { path: "shops", component: Shops },
                { path: "notice", component: Notice },
                { path: "users2", component: Users2 },
                { path: "type", component: Type },
            ]
        },
        { path: '/shopdetails', component: ShopDetails, name: 'ShopDetails' },
        { path: '/noticeform',name:'noticeform', component: NoticeForm }
    ]
})

router.beforeEach((to, from, next) => {
    // console.log(to);
    // console.log(from);
    next();
})

export default router
